/**	
 * Author : Mht
 * Desc : For 2016 RDM 
 */
package dynamic;

import org.apache.commons.lang3.Validate;

/**
 * @author Mht
 * @date Jun 14, 2016
 */
public class RoutingContextHolder<T> {
	@SuppressWarnings("rawtypes")
	private static final ThreadLocal contextHolder = new ThreadLocal();

	@SuppressWarnings("unchecked")
	public static <T> void setContext(T context) {
		Validate.notNull(context, "Must have context!");
		contextHolder.set(context);
	}

	@SuppressWarnings("unchecked")
	public static <T> T getContext() {
		return (T) contextHolder.get();
	}
}